<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<%@ page import="com.easyui.common.UserLogin" %>

<%
	String userID = (String)session.getAttribute("userID");
	String role = (String)session.getAttribute("role");
	String userName = "";
	if(userID != null && role != null && !userID.trim().equals("") && !role.trim().equals("")) {
		if(role.equals("admin")) {
			userName = "admin";	
		} else {
			userName = new UserLogin().getName(role, userID);
		}
	} else {
		response.sendRedirect("login.html");
	}
	
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title>项目管理系统</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" >
  <script type="text/javascript" src="js/jquery-easyui-1.3.5/jquery.min.js" charset="UTF-8"></script>
  <script type="text/javascript" src="js/jquery-easyui-1.3.5/jquery.easyui.min.js" charset="UTF-8"></script>
  <link rel="stylesheet" href="js/jquery-easyui-1.3.5/themes/default/easyui.css" type="text/css"></link>
  <link rel="stylesheet" href="js/jquery-easyui-1.3.5/themes/icon.css" type="text/css"></link>
  <link rel="stylesheet" href="css/main.css" type="text/css"></link>
  <script type="text/javascript" src="js/mine.js"></script>
  <script type="text/javascript" src="js/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js" charset="UTF-8"></script>
 
  <script type="text/javascript" charset="UTF-8">
	  		var adminLayout;
  			var url;
  			var role = "<%= role %>";
	  		$(function(){
	  			adminLayout = $('#adminLayout').layout();
	  			
	  			if(role == 'admin') {
	  				url = 'tree_data_admin.json';
	  			} else if(role == 'teacher') {
	  				url = 'tree_data_teacher.json';
	  			} else if(role == 'student') {
	  				url = 'tree_data_student.json';
	  			}
	  			
	  			$('#tt').tree({
	  				url:url,
	  				lines:true,
	  				onClick:function(node) {
	  					addTab(node);
	  				},
	  				onDblClick:function(node) {
	  					if(node.state == 'closed') {
	  						$(this).tree('expand',node.target);
	  					} else {
	  						$(this).tree('collapse',node.target);
	  					}
	  				}
	  			});
	  			
	  			$.messager.show({
					title:'提示',
					msg:'登录成功'
				});

	  		});
	  	
	  		quit = function() {
	  			$.messager.confirm('提示','确定要退出吗?',function(b) {
					if(b) {
						$.ajax({
							url:'servlet/QuitLoginServlet',
							dataType:'json',
							success:function(r) {
								if(r && r.success) {
									window.location.href = "login.html";
								} else {
									$.messager.alert('出错啦','退出登录失败.','error');
								}
							}
						});
					}
	  			});
			}
	  		
	  </script>
  </head>
  
  <body>
    <div id="adminLayout" fit="true">
		<div region="north" title="North Title" split="false" noheader="true" style="height:60px;background-color:#E0ECFF;overflow:hidden;" border="false">	
			<div style="float:right;margin-top:30px;">
             	<p>欢迎您登陆系统,&nbsp;
             		<span style="color:#F90;"><%= userName %>&nbsp;&nbsp;&nbsp;</span>
             		<img src="images/exit.png" align="texttop"  /> <a href="javascript:void(0)" onclick="quit();">退出</a> 
             		<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
             	</p>
             </div>
			<div>
				<p style="width:400px; margin:0 auto;"><img src="images/font.png" style="margin-top:5px;" /></p>
             </div>  
             
             
		</div>
		<div region="south" title="South Title" split="false" noheader="true" style="height:40px;" border="true">
			<p style="width:500px;margin:0 auto; margin-top:10px;">重庆邮电大学 版权所有  Tel:023-6477818  地址:重庆市南岸区崇文路2号附2号</p>
		</div>
		<div region="west" split="true" title="功能导航" iconCls="icon-blank" style="width:250px;" >
			<ul id="tt"></ul>
		</div>
		<div region="center" border="true" >
			<div id="menuTab" class="easyui-tabs" border="false" fit="true"></div>	
		</div>
		<div id="projectDetailDialog" ></div>
		<div id="modifyProjectDialog" ></div>
		<div id="showProjectDialog" ></div>
		<div id="addProjectDialog" ></div>
		<div id="addHeadNoteDialog" ></div>
		<div id="uploadDialog" ></div>
	</div>
	
  </body>
</html>






